package org.lc.stk.service.question.impl;

import org.lc.stk.service.question.ChoiceQuestionService;
import org.lc.stk.web.dto.question.ChoiceQuestionDTO;
import org.springframework.stereotype.Service;

@Service
public class ChoiceQuestionServiceImpl
    extends BaseQuestionServiceImpl<ChoiceQuestionDTO>
    implements ChoiceQuestionService {

    @Override
    public boolean validateOptionIndexes(ChoiceQuestionDTO dto) {
        // 选择题选项索引验证逻辑
        return dto.getOptions() != null &&
               dto.getOptions().size() >= 2;
    }

    @Override
    public boolean validateMultipleAnswers(ChoiceQuestionDTO dto) {
        // 多选题答案验证逻辑
        return !dto.isMultiple() ||
               (dto.getCorrectOptionIndexes() != null &&
                dto.getCorrectOptionIndexes().size() > 1);
    }

    @Override
    public boolean validateAnswerIndexes(ChoiceQuestionDTO dto) {
        // 答案索引验证逻辑
        return dto.getCorrectOptionIndexes() != null &&
               !dto.getCorrectOptionIndexes().isEmpty();
    }
}